<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="<%= 60-second(now()) %>">
<title>HeaderBar</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link href="UniversalStyleSheet.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function logout()
{
user=parent.frames(0).username.value
Uid=parent.frames(0).Uid.value
window.location="headerBar.asp?logout=logout&user=" + user + "&Uid=" + Uid

}
</script>
<script type="text/vbscript">
function ChangeApp(app)
select case app
	case "Search"
		which="Search_Panel.html"
		dorefresh=1
		parent.frames(0).application.value="Search"
	case "Operator"
		which="applicationframeset.asp"
		dorefresh=1
		parent.frames(0).application.value="Operator"
	case "Dispatch"
		which="dispatchframeset.html"
		dorefresh=1
		parent.frames(0).application.value="Dispatch"
	case "Admin"
		which="adminframeset.html"
		dorefresh=1
		parent.frames(0).application.value="Admin"
	case "Help"
		dorefresh=0
		url="Help.html"
		title="Help"
		params="width=900,height=500,status=no"
		popup=window.open (url,title,params)
		
end select
if dorefresh=1 then
	parent.parent.frames(1).location.href=which
	window.location.href="HeaderBar.asp"
end if

end function
</script>
<style type="text/css">
<!--
.style9 {font-size: small}
-->
</style>
</head>


<body>
<table width="100%" border="0" cellpadding="0" cellspacing="1" background="Images/HeaderBG.png">
  <tr>
    <td width="187" valign="middle" class="SearchFormText"><img src="Images/XcelLogo.png" width="185" height="36" /></td>
    <td width="364" align="center" class="HeaderMessage">
	<% 'display admin message
		dim db,rs
		set db=server.CreateObject("adodb.connection")
		set rs=server.CreateObject("adodb.recordset")
		FilePath=server.MapPath("access/backend/admin.mdb")
		db.open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath)
		sql="MessageToUsers"
		rs.open sql,db,1,2
		rs.movefirst
		message=rs("message")
		rs.close
		db.close
		set rs=nothing
		set db=nothing
		response.Write(replace(message,"_"," "))
	%>	</td>
    <td width="77" align="right" valign="bottom" class="HeaderMessage">
	<table width="1" height="20" border="" cellpadding="0" cellspacing="1" >
      <tr>
	  	<script type="text/vbscript" language="vbscript">
		
		app=parent.frames(0).application.value
		if app="" then app="Search"
		tablist="Search|Operator|Dispatch|Admin|Help"
		tabs=split(tablist,"|")
		navstr=""
		for x = 0 to ubound(tabs)
		navstr=navstr & "<td width='75' style='text-align:center;"
			if app = tabs(x) then
				navstr=navstr & " background-image:url(Images/TabOn.png)'>&nbsp;&nbsp;" & tabs(x) & "&nbsp;&nbsp;"
			else
				navstr=navstr & " background-image:url(Images/TabOff.png)'><a href= 'vbscript: ChangeApp(" & chr(34) & tabs(x) & chr(34) & ")'>&nbsp;&nbsp;" & tabs(x) & "&nbsp;&nbsp;</a>"
			end if
		next 
		navstr=navstr & "</td>"
		document.write (navstr)
		</script>
      </tr>
    </table></td>
    <td width="154" align="right" class="HeaderMessage"><% if request.QueryString("logout")="" then
		%>
		<a href="javascript: logout()"><img src="Images/LogOutButton.png" alt="Log Out" width="60" height="30" border="0" /></a>
    	<%	
			if application("users")="" then
				redim userlist(0)
				redim Uidlist(0)
				userlist(0)=""
				Uidlist(0)=""
			else
				userlist=split(application("users"),"|")
				Uidlist=split(application("Uids"),"|")
			end if
			
			%>
			
			<script type="text/vbscript">
				user=parent.frames(0).username.value
				Uid=parent.frames(0).Uid.value
				found=0
				<%
				for x=0 to ubound(userlist)
					%>
					if (user="<%=userlist(x)%>") and (Uid="<%=Uidlist(x) %>") then found=1
					<% 
				next
				%>
				if found=0 then window.location="HeaderBar.asp?logout=logout&user=" & user & "&Uid=" & Uid
			</script>
			<%	
		end if
	
	if request.QueryString("LogOut")="logout" then
		user=request.QueryString("user")
		Uid=request.QueryString("Uid")
		userlist=split(application("users"),"|")
		Uidlist=split(application("Uids"),"|")
		x=0
		for x=0 to ubound(userlist)
			if userlist(x)<>user then
				z=z+1
				if z=1 then
					temp=userlist(x)
					temp2=Uidlist(x)
				else
					temp=temp & "|" & userlist(x)
					temp2=temp2 & "|" & Uidlist(x)
				end if
			end if
		next
		application("users")=temp
		application("Uids")=temp2
		
		%>
      <script type="text/vbscript">
	  		parent.frames(0).username.value=""
			parent.frames(0).Uid.value=""
			parent.frames(0).application.value=""
			parent.parent.ApplicationFrame.location="LoginScreen.asp"
		</script>
    <%
	end if
	%>&nbsp;</td>
  </tr>
</table>
</body>
</html>
